<%@page import="java.net.URLEncoder"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.sh.xxj.rebot.service.*" language="java"%>
<%@ page import="com.sh.xxj.rebot.app.*" language="java"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>图片比较</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
</head>
<%
String word=request.getParameter("word");
int nIndex=0;
int sheetIndex=8;
String nextWord="无";
if(word==null)
{
	String nameIndex=request.getParameter("index");
	if(nameIndex!=null)
	{
		nIndex=Integer.parseInt(nameIndex);
		word=TestApp.getListNames(sheetIndex).get(nIndex);
		if(nIndex<TestApp.getListNames(sheetIndex).size())
		{
			nIndex++;
			nextWord=TestApp.getListNames(sheetIndex).get(nIndex);
		}
		else
		{
			nextWord="没有了";
		}
		
	}
	else
	{
		word="无";
		nextWord=TestApp.getListNames(sheetIndex).get(nIndex);
	}
}
String encodeWord=URLEncoder.encode(word, "UTF-8") ;

//翻译....
CourseService cs = new CourseService();
ConfigService.TRANSLATE_API = "http://translate.google.cn/translate_a/t?client=t&sl=zh-CN&tl=en&hl=zh-CN&sc=2&ie=UTF-8&oe=UTF-8&prev=btn&ssel=3&tsel=6&q=@p1@";
//翻译的文字
String tWord=cs.getTranslate(word);
String encodetWord=URLEncoder.encode(tWord, "UTF-8") ;

String google_pic_url="http://www.google.com.hk/search?site=imghp&tbm=isch&source=hp&q="+encodetWord;

 %>
<body>
	<form name="input" action="comparepic.jsp" method="get" height="50">
		名字: <input type="text" name="word" value=<%=word %>> <input type="submit"
			value="Submit">
		<a href=<%=google_pic_url %>>google(<%=tWord%>)</a>
		<a href="comparepic.jsp?index=<%=nIndex%>">下一个(<%=nextWord %>)</a>
	</form>
	<iframe src="comparepic/baidu_pic.jsp?word=<%=encodeWord%>"  frameborder=no width="600" scrolling="no" height=100% ></iframe>
	<iframe src="comparepic/baidu_pic.jsp?word=<%=encodetWord%>"  frameborder=no width="600" scrolling="no" height=100% ></iframe>
	
</body>
</html>
